package com.webdrider.security.errors;

import com.common.security.abstracts.AbstractError;

/**
 * Error code range: 121 - 140
 * 
 * @author Ady
 *
 */
public class SnippetError extends AbstractError {
	
	public static final int NO_DOMAIN_PROVIDED = 121;
	private static final String MESSAGE_NO_DOMAIN_PROVIDED = "The domain was not provided.";
	private static final String CAUSE_NO_DOMAIN_PROVIDED = "The domain was not created or the provided value is empty.";
	private static final String DESCRIPTION_NO_DOMAIN_PROVIDED = "Make sure the domain value is provided and try again.";

	public static final int DOMAIN_BAD_FORMAT = 122;
	private static final String MESSAGE_DOMAIN_BAD_FORMAT = "The domain was provided in a bad format.";
	private static final String CAUSE_DOMAIN_BAD_FORMAT = "The domain was either too long, too short or had forbidden characters.";
	private static final String DESCRIPTION_DOMAIN_BAD_FORMAT = "Make sure the domain length is between the bounds and it doesn't contain any forbidden characters and try again.";
	
	public static final int DOMAIN_EXISTS = 123;
	private static final String MESSAGE_DOMAIN_EXISTS = "The domain allready exists.";
	private static final String CAUSE_DOMAIN_EXISTS = "A duplicate of the domain was found.";
	private static final String DESCRIPTION_DOMAIN_EXISTS = "Try with another domain.";
	
	public static final int DOMAIN_NOT_FOUND = 124;
	private static final String MESSAGE_DOMAIN_NOT_FOUND = "The requested domain was not found.";
	private static final String CAUSE_DOMAIN_NOT_FOUND = "The domain was either deleted or it never existed.";
	private static final String DESCRIPTION_DOMAIN_NOT_FOUND = "Try to use some other domain or add it into the system.";
	
	public static final int NO_CONTENT_PROVIDED = 125;
	private static final String MESSAGE_NO_CONTENT_PROVIDED = "The content was not provided.";
	private static final String CAUSE_NO_CONTENT_PROVIDED = "The content tag was empty.";
	private static final String DESCRIPTION_NO_CONTENT_PROVIDED = "Add the content to the request.";
	
	public static final int CONTENT_BAD_FORMAT = 126;
	private static final String MESSAGE_CONTENT_BAD_FORMAT = "The content was provided in a bad format.";
	private static final String CAUSE_CONTENT_BAD_FORMAT = "The content was either too long, too short or had forbiiden characters.";
	private static final String DESCRIPTION_CONTENT_BAD_FORMAT = "Make sure the content length is between the bounds and it doesn't have forbidden characters and try again.";
	
	public static final int NO_TITLE_PROVIDED = 127;
	private static final String MESSAGE_NO_TITLE_PROVIDED = "The title was not provided.";
	private static final String CAUSE_NO_TITLE_PROVIDED = "The title tag was empty.";
	private static final String DESCRIPTION_NO_TITLE_PROVIDED = "Add the title to the request.";
	
	public static final int TITLE_BAD_FORMAT = 128;
	private static final String MESSAGE_TITLE_BAD_FORMAT = "The title was provided in a bad format.";
	private static final String CAUSE_TITLE_BAD_FORMAT = "The title was either too long, too short or had forbidden characters.";
	private static final String DESCRIPTION_TITLE_BAD_FORMAT = "Make sure the title length is between the bounds and it doesn't have forbidden characters and try again.";
	
	public static final int TAG_BAD_FORMAT = 129;
	private static final String MESSAGE_TAG_BAD_FORMAT = "The tag was provided in a bad format";
	private static final String CAUSE_TAG_BAD_FORMAT = "The tag was either too long, too short or had forbidden characters";
	private static final String DESCRIPTION_TAG_BAD_FORMAT = "Make sure the tag length is between the bounds and it doesn't have forbidden characters and try again.";
	
	public static final int DUPLICATE_TAG = 130;
	private static final String MESSAGE_DUPLICATE_TAG = "A duplicate tag was provided";
	private static final String CAUSE_DUPLICATE_TAG = "Two tags with the same value was provided and that is forbidden";
	private static final String DESCRIPTION_DUPLICATE_TAG = "Delete one of the duplicate tags and try again";
	
	public SnippetError(int code) {
		super(code);
		
		switch(code) {
			case NO_DOMAIN_PROVIDED: {
				setMessage(MESSAGE_NO_DOMAIN_PROVIDED);
				setCause(CAUSE_NO_DOMAIN_PROVIDED);
				setDescription(DESCRIPTION_NO_DOMAIN_PROVIDED);
				break;
			}
			case DOMAIN_BAD_FORMAT: {
				setMessage(MESSAGE_DOMAIN_BAD_FORMAT);
				setCause(CAUSE_DOMAIN_BAD_FORMAT);
				setDescription(DESCRIPTION_DOMAIN_BAD_FORMAT);
				break;
			}
			case DOMAIN_EXISTS: {
				setMessage(MESSAGE_DOMAIN_EXISTS);
				setCause(CAUSE_DOMAIN_EXISTS);
				setDescription(DESCRIPTION_DOMAIN_EXISTS);
				break;
			}
			case DOMAIN_NOT_FOUND: {
				setMessage(MESSAGE_DOMAIN_NOT_FOUND);
				setCause(CAUSE_DOMAIN_NOT_FOUND);
				setDescription(DESCRIPTION_DOMAIN_NOT_FOUND);
				break;
			}
			case NO_CONTENT_PROVIDED: {
				setMessage(MESSAGE_NO_CONTENT_PROVIDED);
				setCause(CAUSE_NO_CONTENT_PROVIDED);
				setDescription(DESCRIPTION_NO_CONTENT_PROVIDED);
				break;
			}
			case CONTENT_BAD_FORMAT: {
				setMessage(MESSAGE_CONTENT_BAD_FORMAT);
				setCause(CAUSE_CONTENT_BAD_FORMAT);
				setDescription(DESCRIPTION_CONTENT_BAD_FORMAT);
				break;
			}
			case NO_TITLE_PROVIDED: {
				setMessage(MESSAGE_NO_TITLE_PROVIDED);
				setCause(CAUSE_NO_TITLE_PROVIDED);
				setDescription(DESCRIPTION_NO_TITLE_PROVIDED);
				break;
			}
			case TITLE_BAD_FORMAT: {
				setMessage(MESSAGE_TITLE_BAD_FORMAT);
				setCause(CAUSE_TITLE_BAD_FORMAT);
				setDescription(DESCRIPTION_TITLE_BAD_FORMAT);
				break;
			}
			case TAG_BAD_FORMAT: {
				setMessage(MESSAGE_TAG_BAD_FORMAT);
				setCause(CAUSE_TAG_BAD_FORMAT);
				setDescription(DESCRIPTION_TAG_BAD_FORMAT);
				break;
			}
			case DUPLICATE_TAG: {
				setMessage(MESSAGE_DUPLICATE_TAG);
				setCause(CAUSE_DUPLICATE_TAG);
				setDescription(DESCRIPTION_DUPLICATE_TAG);
				break;
			}
		}
	}

}
